package main;

import javax.swing.JOptionPane;

public class Setup {
	/*
	 * Pause program for 5 milliseconds so that Frame repaints
	 */
	public static void sleep() {
		try {
			Thread.sleep(5);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	/*
	 * Initialize all components and start while loop to run program
	 */
	public static void main(String[] args) {
		Frame window = new Frame(); // Frame in which program is displayed
		JOptionPane.showMessageDialog(window, "Warning: Program can use large amounts of CPU.\nYou should close any applications you have\nrunning before trying to simulate anything too\ncomplicated.");
		GPanel panel = new GPanel(); // Panel in which graphics are displayed
		Manager manager = new Manager(); // Runs calculations every time panel
											// repaints
		PropertiesWindow properties = new PropertiesWindow(); // Window to
																// adjust
																// settings
		properties.setAlwaysOnTop(true);
		window.setPropertiesWindow(properties);
		properties.setManager(manager);
		manager.setComponents(window, properties);
		panel.setSize(701, 501);
		window.add(panel);
		window.setManager(manager);
		panel.setManager(manager);
		window.setVisible(true);
		window.setLocation(100, 100); // Set location because window cannot be
										// moved
		while (true) {
			panel.repaint();
			sleep();
		}
	}

}
